<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>供应商管理</title>

    <!-- Favicon -->
    <link rel="shortcut icon" th:href="@{/assets/media/image/favicon.png}"/>

    <!-- Plugin styles -->
    <link rel="stylesheet" th:href="@{/vendors/bundle.css}" type="text/css">

    <!-- Datepicker -->
    <link rel="stylesheet" th:href="@{/vendors/datepicker/daterangepicker.css}">

    <!-- Vmap -->
    <link rel="stylesheet" th:href="@{/vendors/vmap/jqvmap.min.css}">

    <!-- App styles -->
    <link rel="stylesheet" th:href="@{/assets/css/app.css}" type="text/css">
    <!--弹窗CSS-->
    <link rel="stylesheet" th:href="@{/assets/css/modal.css}" type="text/css">
</head>
<body class="container">
<!--自定义宽度-->
<!-- begin::preloader-->
<div class="preloader">
    <div class="preloader-icon"></div>
</div>
<!-- end::preloader -->

<!-- begin::header -->
<div th:replace="~{commons/header :: header}"></div>
<!-- end::header -->

<!-- begin::main -->
<div id="main">

    <!-- begin::navigation -->
    <div th:replace="~{commons/navigation :: navigation}"></div>
    <!-- end::navigation -->

    <!-- begin::main-content -->
    <div class="main-content">

        <!-- begin::page content -->
        <div class="container-fluid">

            <div class="row">
                <div class="col-md-12 card">
                    <div class="row anno">
                        供应商信息
                    </div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <td>供应商编号</td>
                                <td th:text="${supplierMap.get('supplier_id')}">1</td>
                            </tr>
                            <tr>
                                <td>供应商名称</td>
                                <td th:text="${supplierMap.get('supplier_name')}">供应商1</td>
                            </tr>
                            <tr>
                                <td>法人代表</td>
                                <td th:text="${supplierMap.get('master_name')}">小红</td>
                            </tr>
                            <tr>
                                <td>省份</td>
                                <td th:text="${supplierMap.get('province')}">广西</td>
                            </tr>
                            <tr>
                                <td>详细地址</td>
                                <td th:text="${supplierMap.get('address')}">广西桂林XXXX</td>
                            </tr>
                            <tr>
                                <td>注册资金</td>
                                <td th:text="${supplierMap.get('money')+'万'}">100.00万</td>
                            </tr>
                            <tr>
                                <td>联系人姓名</td>
                                <td th:text="${supplierMap.get('link_name')}">小红</td>
                            </tr>
                            <tr>
                                <td>联系电话</td>
                                <td th:text="${supplierMap.get('phone')}">8888888</td>
                            </tr>
                            <tr>
                                <td>传真</td>
                                <td th:text="${supplierMap.get('fax')}">XXXXXXXXX</td>
                            </tr>
                            <tr>
                                <td>电子邮箱</td>
                                <td th:text="${supplierMap.get('email')}">123123123@123.123</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 card">
                    <div class="row anno">
                        <img th:src="@{/image/anno.png}">
                        审核记录
                    </div>
                    <div class="table-responsive">
                        <table class="table">
                            <thead>
                            <tr>
                                <th scope="col">序号</th>
                                <th scope="col">申请时间</th>
                                <th scope="col">供应商类型</th>
                                <th scope="col">审核人</th>
                                <th scope="col">审核时间</th>
                                <th scope="col">状态</th>
                                <th scope="col">审核信息</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="map,mapstart:${check}">
                                <td th:text="${mapstart.count}">1</td>
                                <td th:text="${#dates.format(map.get('apply_time'), 'yyyy-MM-dd HH:mm:ss')}">
                                    2015-08-21
                                </td>
                                <td th:if="${map.get('supplier_type')=='general'}">一般供应商</td>
                                <td th:if="${map.get('supplier_type')=='temporary'}">临时供应商</td>
                                <td th:if="${map.get('supplier_type')=='internal'}">内部供应商</td>
                                <td th:if="${map.get('supplier_type')=='emphasis'}">重点供应商</td>
                                <td th:text="${map.get('name')}">刘备</td>
                                <td th:text="${#dates.format(map.get('audit_time'), 'yyyy-MM-dd HH:mm:ss')}">
                                    2015-08-21
                                </td>
                                <td th:if="${map.get('audit_status')=='agree'}">通过</td>
                                <td th:if="${map.get('audit_status')=='rejected'}">驳回</td>
                                <td th:if="${map.get('audit_status')=='pending'}">待审核</td>
                                <td th:text="${map.get('audit_info')}">同意</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 card">
                    <div class="row anno">
                        供应商类型
                    </div>
                    <div>
                        <form id="supplierType" method="POST">
                            <div style="margin-bottom:10px;">
                                <span>供应商类型:</span>
                                <span style="margin:10px;"><input name="supplierType" type="radio" value="temporary"/>&nbsp临时供应商</span>
                                <span style="margin:10px;"><input name="supplierType" type="radio" value="general" checked/>&nbsp一般供应商</span>
                                <span style="margin:10px;"><input name="supplierType" type="radio" value="internal"/>&nbsp内部供应商</span>
                                <span style="margin:10px;"><input name="supplierType" type="radio" value="emphasis"/>&nbsp重点供应商</span>
                            </div>
                            <div>
                                <input type="submit" name="resultBtn" class="btn btn-info" onclicked
                                       style="margin-left: 50px"
                                       value="修改"/>
                                <input onclick="javascript:history.go(-1)" type="button" class="btn btn-info"
                                       style="margin-left: 50px"
                                       value="返回"/>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </div>


        <!-- end::page content -->

        <!-- begin::footer -->
        <footer>
            <div class="container-fluid">
                <div>© 2019 Protable v1.0.0 Made by <a href="http://bootstrapmb.com">Laborasyon</a></div>
                <div>
                    <nav class="nav">
                        <a href="" class="nav-link">Licenses</a>
                        <a href="#" class="nav-link">Change Log</a>
                        <a href="#" class="nav-link">Get Help</a>
                    </nav>
                </div>
            </div>
        </footer>
        <!-- end::footer -->

    </div>
    <!-- end::main-content -->

</div>
<!-- end::main -->
<div th:include="~{commons/scripts :: scripts}"></div>


<!-- App scripts -->
<script th:src="@{/assets/js/app.js}"></script>
<script th:src="@{/assets/js/modal.js}"></script>

<script th:inline="javascript">
    $(() => {
        $('#supplierType').submit(function () {
            var supplierType=$('input:radio:checked').val();
            var data = $("#companyApply").serializeArray();   // 可以增加表单数据
            var supplierId = [[${supplierMap.get('supplier_id')}]]
            data.push({"name": "supplierId", "value": supplierId});
            data.push({"name": "supplierType", "value": supplierType});
            let url = "/supplier/updataSupplierType";
            $.post(url, data, function (data) {
                if (data.code == 200) {
                    method = function () {
                        window.location.href = [[${#request.getHeader('Referer')}]]
                    }
                } else {
                    method = function () {
                        window.location.reload();
                    }
                }
                let mModal1 = new mModal({
                    title: "提示", // 标题，默认：提示
                    width: "25%", // 弹出框宽度，默认 25%
                    top: "25vh", // 距离可视区域顶部距离 CSS中 margin-top 值
                    content: data.msg, // 正文，默认：正文内容
                    cancelText: "取 消", // 取消按钮文本
                    confirmText: "确 定", // 确定按钮文本
                    showCancelButton: false, // 是否显示取消按钮
                    showConfirmButton: true, // 是否显示确定按钮
                    showClose: true, // 是否显示关闭按钮
                    modal: true, // 是否需要遮罩层
                    customClass: "", // 自定义类名confirm
                    confirm: function () {
                        mModal1.close();
                        method();
                    },
                });
                console.log(111)
                mModal1.renderDom();
            }, "json")
            return false;

        })
    })
</script>
</body>

</html>